<?php
include '../conn.php';
include "t-cookie.php";
$tid = $_SESSION['t-id'];
$pid = $_GET['projectid'];
$sid = $_GET['studentid'];
$method = $_GET['method'];

if ($method == "choose") {
    $sidsql = "select StudentName,s.StudentId,Major,Class,Tel,email,c.intention  from student as s
  JOIN choosesubject as c ON s.StudentId=c.StudentId
WHERE s.StudentId=$sid";
    $pidsql = "select ProjectName,TeacherName,Tel from project as p
join teacher as t on p.Teacher_TeacherId=t.TeacherId
WHERE ProjectId=$pid";
    $sidresult = $conn->query($sidsql);
    $pidresult = $conn->query($pidsql);
    $sidrow = $sidresult->fetch_array();
    $pidrow = $pidresult->fetch_array();
}
if ($method == "catch") {
    $sidsql = "select StudentName,s.StudentId,Major,Class,Tel,email,intention from student as s
JOIN probyself as p ON s.StudentId=p.StudentId WHERE s.StudentId=$sid";
    $pidsql = "select ProjectName,TeacherName,Tel from project as p
join teacher as t on p.Teacher_TeacherId=t.TeacherId
WHERE ProjectId=$pid";
    $sidresult = $conn->query($sidsql);
    $pidresult = $conn->query($pidsql);
    $sidrow = $sidresult->fetch_array();
    $pidrow = $pidresult->fetch_array();
}
?>

<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--<title></title>-->
    <link rel="stylesheet" type="text/css" href="../css/htmleaf-demo.css">
    <link rel="stylesheet" type="text/css" href="../css/nav.css">
    <link rel="stylesheet" type="text/css" href="../fonts/iconfont.css">

    <link rel="stylesheet" href="../css/bootstrap-theme.css"/>

    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <link rel="stylesheet" href="../css/bootstrap-theme.min.css"/>
    <link rel="stylesheet" href="../css/bootstrap.css"/>
    <script type="text/javascript" src="../js/bootstrap3.0.3.min.js"></script>

<!--    <link rel="stylesheet" type="text/css" href="../css/style.css">-->

    <style>
        table {
            width: 50%;
        }

        td:nth-child(1) {
            width: 20%;
            text-align: center;
        }

        td:nth-child(2) {
            width: 35%;
        }

        td:nth-child(3) {
            width: 10%;
            text-align: center;
        }

        td:nth-child(4) {
            width: 35%;
        }

        input {
            border: none;
            width: 100%;
        }

        textarea {
            border: none;
            width: 100%;
        }
        .keti{
            margin-top:0px;
            padding-top: 50px;
            border: 0;

        }
        .keti table {
            width: 50%;
            table-layout: fixed;

        }

        .keti td:nth-child(1) {
            width: 20%;
            text-align: center;
        }

        .keti  td:nth-child(2) {
            width: 35%;
        }

        .keti td:nth-child(3) {
            width: 10%;
            text-align: center;
        }

        .keti  td:nth-child(4) {
            width: 35%;
        }

        .keti  input {
            border: none;
            width: 100%;
        }

        .keti textarea {
            border: none;
            width: 100%;
        }
        @media screen and (max-width: 900px) {

            .keti td{
                font-size:6px;
            }
        }
        @media screen and (max-width: 500px) {
            .keti td{
                font-size:3px;
            }
        }

    </style>
    <script type="text/javascript" src="../js/jquery-1.11.0.min.js"></script>
    <script>
        function addtask(method, projectid, studentid) {
            var date = document.getElementById('date').value;
            alert(date);
            $.ajax({
                type: "POST",
                url: "t-choosestudent.php",
                data: "method=" + method + "&ProjectId=" + projectid + "&StudentId=" + studentid + "&date=" + date,
                success: function (msg) {
                    alert("提示: " + msg);

                }
            });
        }

    </script>

</head>

<body >

<div class=" panel-default auto keti" align="center">

    <center>
        <h3>选课信息</h3>

        <table border="1px" class="table table-striped ">
            <tr style="background-color: #f0f8ff">
                <td style="border: 0" colspan="4">学生填写部分:</td>
            </tr>
            <tr>
                <td style="background-color: #f0f8ff">姓名</td>
                <td><input  value="<?= $sidrow[0] ?>" readonly="true" >
                </td>
                <td style="background-color: #f0f8ff">学号</td>
                <td><input  value="<?= $sidrow[1] ?>" readonly="true" >
                </td>
            </tr>
            <tr>
                <td style="background-color: #f0f8ff">专业</td>
                <td><input  value="<?= $sidrow[2] ?>" readonly="true" style="background-color: #f9f9f9">
                </td>
                <td style="background-color: #f0f8ff">班别</td>
                <td><input  value="<?= $sidrow[3] ?>" readonly="true"  style="background-color: #f9f9f9">
                </td>
            </tr>
            <tr>
                <td style="background-color: #f0f8ff">联系电话</td>
                <td colspan="3"><input  value="<?= $sidrow[4] ?>" readonly="true"'>
                </td>
            </tr>
            <tr>
                <td style="background-color: #f0f8ff">E-MAIL</td>
                <td colspan="3"><input value="<?= $sidrow[5] ?>" readonly="true" style="background-color: #f9f9f9">
                </td>
            </tr>
            <tr>
                <td style="background-color: #f0f8ff">选题名称</td>
                <td colspan="3"><input  value="<?= $pidrow[0] ?>" readonly="true">
                </td>
            </tr>
            <tr>
                <td style="background-color: #f0f8ff">选课意向</td>
                <td colspan="3"><textarea id="mask" readonly="true" style="background-color: #f9f9f9"><?= $sidrow[6] ?></textarea></td>
            </tr>
            <tr style="background-color: #f0f8ff">
                <td style="border: 0" colspan="4" >指导教师填写部分：</td>
            </tr>
            <tr>
                <td style="background-color: #f0f8ff">确定选题</td>
                <td><input  value="<?= $pidrow[0] ?>" style="background-color: #f9f9f9"></td>
                <td style="background-color: #f0f8ff">完成时间</td>
                <td><input type="date" id="date" style="background-color: #f9f9f9"></td>
            </tr>
            <tr>
                <td style="background-color: #f0f8ff">指导老师</td>
                <td><input  value="<?= $pidrow[1] ?>" "></td>
                <td style="background-color: #f0f8ff">联系电话</td>
                <td><input  value="<?= $pidrow[2] ?>"></td>
            </tr>
            <tr>
                <td><input type="button" value="提交" onclick="addtask('<?= $method ?>',<?= $pid ?>,<?= $sid ?>)">
                </td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
        </table>
    </center>

</div>
<script>
    window.jQuery || document.write('<script src="../js/jquery-1.11.0.min.js"><\/script>')
</script>


</body>

</html>
















